package com.linwen.javase.desgin_pattern.BigTalkDesignPattenJAVACode._05工厂方法模式._3计算器扩展;

/**
 * @ClassName OperationFactory
 * @Description TODO
 * @Author zero
 * @DATE 2023/7/18 8:35 AM
 * @Version 1.0
 */
public class OperationFactory {

    public static Operation createOperate(String strOperate) {
        Operation operation = null;
        IFactory factory = null;
        switch (strOperate){
            case "+":
            case "-":
            case "*":
            case "/":
                factory = new FactoryBasic();
                break;
            case "pow":
            case "log":
                //高级运算工厂实例
                factory=new FactoryAdvanced();
                break;

        }
        return factory.createOperation(strOperate);
    }
}
